package com.qczl.pme.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.qczl.core.controller.BaseController;
import com.qczl.model.Json;
import com.qczl.pme.service.ScreenService;

/**
 * 摄像头视频屏幕控制器
 * @author SongR
 *
 */
@Controller
@RequestMapping(value="/screen")
public class ScreenController extends BaseController{

	Logger log = Logger.getLogger(this.getClass());	
	
	@Autowired
	ScreenService service;
	
	/**
	 * 摄像头视频屏幕截图
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/take/metting/v1")
	public Json take(HttpSession session,HttpServletRequest request,HttpServletResponse response){
		Json j = new Json();
		try {
			String cameraId = request.getParameter("cameraid");
			boolean isTrue = service.take(cameraId,0);
			if(isTrue){
				j.setMsg("截图成功！");
			}else{
				j.setMsg("截图失败！");
			}
		} catch (Exception e) {
			j.setMsg("接口异常！");
			j.setSuccess(false);
			j.setState(500);
			log.error("会议视频截图接口异常！",e);
		}
		return j;
	}
	
	
	
}
